#!/bin/sh
num2=0
rr=$(date +%s%N)

while true
do
ping -c 3 -w 3  192.168.3.10 >> /dev/null
if [ $? -eq 0 ];then
        #echo "camera network is ready"
        sleep 8
else
	if [ $num2 -gt 0 ] ; then
                echo "camera network is not ready"
                current_time=$(date "+%Y%m%d-%H%M%S")
                echo $current_time > /opt/CameraData/log/error-$rr-$current_time.log
                dmesg >> /opt/CameraData/log/error-$rr-$current_time.log
        fi
        num2=`expr $num2 + 1`
        echo $num2
        sleep 5
fi
done
